# 适用的场景，在数据采集的时候，绕过登录，进入到某个页面
import urllib.request
from idlelib.iomenu import encoding

url = 'https://weibo.cn/6126894765/info'

headers = {
    "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0',
    'Cookie': '_T_WM=a3ae1108bbee5073aa74f262fb80ff4f; SCF=Aqm1Kt9p8W9uXa1BfreZxQzKV9o3FyYeiOlAUWjUdUKAzj641P_hUNbS624NpUqd3KQE_KtGp9xCxYQvIr2GI1I.; SUB=_2A25L87GEDeRhGeBP6VQZ-SrLzTmIHXVpcUtMrDV6PUJbktAGLRjWkW1NRXGfSHwSQs9LWD8mfkN6jfJXTStzKcPO; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WWrmiT7hDL3TsOcMk7nDy8h5NHD95QceKzc1h.XS0qfWs4DqcjqMPULeKz0i--Xi-ihiKyWi--Xi-ihiKyW; SSOLoginState=1727513045; ALF=1730105045',

}

request = urllib.request.Request(url=url, headers=headers)

response = urllib.request.urlopen(request)

content = response.read().decode('utf-8')
# print(content)

with open('weibo.html', 'w',encoding='utf-8') as f:
    f.write(content)
